// 云函数入口文件
const cloud = require('wx-server-sdk')

var md5 = require('md5');


cloud.init({
    env:cloud.DYNAMIC_CURRENT_ENV
})


// 云函数入口函数
exports.main = async (event, context) => {
    console.log(
        'cloud.DYNAMIC_CURRENT_ENV',
        cloud.DYNAMIC_CURRENT_ENV
    )
    const {
        rssUrl,
        
    } = event
 
    const db = cloud.database({
        
    })
    await db.collection('rss_subscribe').doc(md5(rssUrl)).set({
        data: {
            url: rssUrl,
            pullTime: '',
            updateTime: +new Date()
        }
    })
    //console.log('同步成功');
}